package test;

import java.util.Scanner;

public class login1 {
    public static void main(String[] args) {

        String rightusername ="王大大";
        String rightpassword = "987456321";

        Scanner sc = new Scanner(System.in);

        for(int i = 0 ; i < 3 ; i++){
            System.out.println("请输入你的用户名");
            String username = sc.next();
            System.out.println("请输入你的密码");
            String password = sc.next();


            if(username.equals(rightusername) && password.equals(rightpassword)){
                System.out.println("登录成功");
                break;
            }else{
                if(i == 2){
                    System.out.println("登录失败"+username+"被锁定，请明天再试");
                }else{
                    System.out.println("登录失败，用户名或者密码输入错误,你还有"+(2-i)+"次机会");
                }

            }


        }



    }
}
